package com.sino.dataworks.enums;

public enum DataWorksTaskStatus {
    NOT_RUN(1,"未运行"),
    WAIT_TIME(2,"等待定时时间"),
    WAIT_RESOURCE(3,"等待资源"),
    RUNNING(4,"运行中"),
    FAILURE(5,"运行失败"),
    SUCCESS(6,"运行成功");
    private int code;
    private String desc;
     DataWorksTaskStatus(int code, String desc){
        this.code=code;
        this.desc=desc;
    }
    

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDesc(int code) {
        for (DataWorksTaskStatus status : DataWorksTaskStatus.values()) {
            if (status.getCode() == code) {
                return status.getDesc();
            }
        }
        return null;
    }
    public static int getCode(String desc) {
        for (DataWorksTaskStatus status : DataWorksTaskStatus.values()) {
            if (status.getDesc().equals(desc)) {
                return status.getCode();
            }
        }
        return 0;
    }
}
